<script>
	$(document).ready(function(){
        var data =<?php echo json_encode($data) ?>;
		for(var i in data){
			$('.form-horizontal [name="'+i+'"]').attr('value',data[i]);
		}
        var errors = <?php echo json_encode($errors) ?>;
        for(var i in errors)
        {
            if(errors[i]!=''){
                $('.form-horizontal [name="'+i+'"]').after('<span class="help-inline">'+errors[i]+'</span>');
                $('.form-horizontal [name="'+i+'"]').parent().parent().addClass('error');
            }

        }
    });
</script>